﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using gfPage;
using gfLibrary;
using DBUtility;
using Model;
using BLL;
using Config;

namespace LabourVerify
{
    public partial class LabourVerifySearch_Detail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
             gfAjaxJs.SetNoCache();

             if (Page.IsPostBack == false)
             {
                string  strAJLSH = Request["UniqueKey"];
                if (strAJLSH != null || strAJLSH != string.Empty)
                {
                    BindList(strAJLSH);
                }
             }
        }

        private DataTable GetDataTable(string LWLSH)
        {
            string strSQL = string.Format("SELECT  [ID],[LWLSH] ,CASE WHEN  RIGHT(JYXM,1) = ',' THEN LEFT(JYXM,LEN(JYXM)-1) ELSE JYXM END AS JYXM ,[LWType],[JKName] ,[SendInfo] ,[RevcInfo],[IsSuc],[LogTime]FROM NET_AJ_JK_RESULT WHERE LWLSH = '{0}'", LWLSH);
            DataTable dt = new DataTable();
            DbHelper.GetTable(strSQL, ref dt);
            return dt;
        }

        private void BindList(string LWLSH)
        {
            DataTable dt = GetDataTable(LWLSH);
            rptList.DataSource = dt;

            rptList.DataBind();
            dt.Dispose();
        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            string strUniqueKey = Request.Form["txtUniqueKey"];

            if((strUniqueKey == null)||(strUniqueKey.Length == 0))
            {
                gfAjaxJs.SetAlertMsg(this.UpdatePanel1, "请选择一条记录！");
                return;
            }

            Response.Redirect("NET_AJ_JK_RESULT_Insert_Update.aspx?m=r&UniqueKey=" + strUniqueKey);
        }

    }
}
